package com.sangharsh.core.algo;

import com.sangharsh.core.algo.location.Location;

public class Vertex {

	private String name;
	private String code;
	private Location location;

	public Vertex(String name, String code, Location location) {
		this.name = name;
		this.code = code;
		this.location = location;
	}
	public Vertex(StopNode node) {
		this(node.getName(), node.getCode(), node.getLocation());
	}

	public String getCode() {
		return code;
	}


	public String toString(){
		return this.code;
	}

	public String getName() {
		return name;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((code == null) ? 0 : code.hashCode());
		return result;
	}


	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Vertex other = (Vertex) obj;
		if (code == null) {
			if (other.code != null)
				return false;
		} else if (!code.equals(other.code))
			return false;
		return true;
	}
	public Location getLocation() {
		return location;
	}
}
